from django.contrib import admin

# Register your models here.
from django.contrib import admin

from crm import models
@admin.register(models.CrmCustomer)
class CustomerAdmin(admin.ModelAdmin):
    list_display = ("name", "type", "phone", "assigned_to", "status", "created_at")
    list_filter = ("type", "status", "assigned_to")
    search_fields = ("name", "phone", "email")
    date_hierarchy = "created_at"

@admin.register(models.FollowUp)
class FollowUpAdmin(admin.ModelAdmin):
    list_display = ("customer", "opportunity", "follow_type", "follow_date", "created_by")
    list_filter = ("follow_type", "created_by")
    search_fields = ("content",)


@admin.register(models.Opportunity)
class OpportunityAdmin(admin.ModelAdmin):
    list_display = ("title", "amount", "probability", "stage", "notes")
    filter_horizontal = ('products',)  # 水平筛选器，便于选择多对多关系